package test;

import java.util.Random;

public class User {
    public void openDoor(Door door) {
        if (door.open()) {
            if (new Random().nextInt(10) > 2){
                System.out.println("打开门");
                return;
            }
        }
        System.out.println("失败");

    }
    public void closeDoor(Door door) {
         System.out.println("关闭门");
    }
}
